package model

import (
	"github.com/gin-gonic/gin"
	"gorm.io/gorm"
	"net/http"
)

type HttpService struct {
	db *gorm.DB
}

//func InitHttp(r *gin.RouterGroup, db *gorm.DB, cfg *config.Config) {
//	s := &HttpService{
//		db:  db,
//		cfg: cfg,
//	}
//	router := r.Group("/model")
//	{
//		router.POST("/hisDataList", s.hisDataList)
//		router.DELETE("/delHisData", s.delHisData)
//		router.GET("/consts", s.consts)
//		router.GET("/count", s.count)
//	}
//}

func (s *HttpService) hisDataList(c *gin.Context) {
	c.JSON(http.StatusOK, "SSSS")
}

func (s *HttpService) consts(c *gin.Context) {
	c.JSON(http.StatusOK, "SSSS")
}

func (s *HttpService) count(c *gin.Context) {
	var count int64
	//name非daw的记录个数
	s.db.Model(&VehicleModelData{}).Count(&count)
	c.JSON(http.StatusOK, count)
}

func (s *HttpService) delHisData(c *gin.Context) {
	c.JSON(http.StatusOK, "SSSS")
}
